<link href="__PUBLIC__/css/comm.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/css/codetaste_person.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script>

<script type="text/javascript">

$(document).ready(function(){
	$("#search_key").change(function(){
		$("#form1").submit();
	});

	$("#is_user").click(function(){
		$("#form1").submit();
	});

});


function submitSp(id){
	$.getJSON('__URL__/getCommodityInfo/id/'+id,function(data){
		if(data.id){
			parent.$(".choose_sp").html("品类：<span id=\"sp_category\">"+data.brand_name+"</span><br />"+
					"品牌：<span id=\"sp_brand\">"+data.category_name+"</span><br />"+
					"品名：<span id=\"sp_commodity\">"+data.name+"</span><br />"+
			    	"<input type=\"hidden\" id=\"hi_category\" name=\"category_id\" value=\""+data.category_id+"\" />"+
			    	"<input type=\"hidden\" id=\"hi_brand\" name=\"brand_id\" value=\""+data.brand_id+"\" />"+
			    	"<input type=\"hidden\" id=\"hi_commodity\" name=\"commodity_id\" value=\""+data.id+"\" />");
			parent.wBox.close();
		}else{
			alert("参数错误");
			parent.wBox.close();
		}
	});
}

</script>
<div id="sp_content">
	<div id="sp_search">
	  <form action="__URL__/spList/" method="POST" id="form1">
		<input type="text" id="search_key" name="search_key" value="{$_mapx['search_key']}">
		<label><input type="checkbox" id="is_user" name="is_user" value="1" <eq name="_mapx['is_user']" value="1">checked</eq> /><span style="margin:-3px 0 0 0;">用户已经分享过的商品</span></label>
	  </form>
	</div>
	<div id="sp_list">
		<ul>
		  <volist name="volist" id="val">
			<li>
			  <a onclick="submitSp({$val.id})">
				<img src="{$val.img}" width="120" height="120"><br><span>{$val.name}</span>
			  </a>
			</li>
		  </volist>
		</ul>
	</div>
	<div class="clear"></div>
	<div id="sp_page">{$page}</div>
</div>
